//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    userInfo:{},
    modules:[
      {
        "name":"chufang",
        "displayName":"处方列表",
        "icon":"https://www.easyicon.net/api/resizeApi.php?id=1081631&size=128",
        "page":"../../pages/chufang/chufang"
      },
      {
        "name":"wuliao",
        "displayName":"vant weapp练习",
        "icon":"https://www.easyicon.net/api/resizeApi.php?id=1081615&size=128",
        "page":"../../pages/vantDemo/vantDemo"
      },
      {
        "name":"gongdan",
        "displayName":"工单",
        "icon":"https://www.easyicon.net/api/resizeApi.php?id=1081623&size=128"
      },
      {
        "name":"pici",
        "displayName":"批次",
        "icon":"https://www.easyicon.net/api/resizeApi.php?id=1081614&size=128"
      }
    ]
  },
  //事件处理函数
  bindViewTap: function() {
    wx.navigateTo({
      url: '../logs/logs'
    })
  },
  onLoad: function () {
      try {
         let userInfo = wx.getStorageSync('userInfo');
         this.setData({
           userInfo:userInfo
         });
      } catch (error) {
         console.log(error) 
      }
  },

  tapModule(e){
    let _module = e.currentTarget.dataset.module;
    if(_module.page){
       wx.navigateTo({
         url: _module.page,
       })
    }else{
      wx.showToast({
        title: '页面不存在',
        icon: 'none',
        duration: 2000
      })
    }
  }

})
